package org.openea.eap.module.obpm.model.form.constants;

import org.openea.eap.module.obpm.util.form.Util;

import java.util.Set;


/**
 * 定制SQL展示常量定义
 */
public interface ViewConstants {

    // 查询参数类型
    public static interface SearchParamsType {
        public static final int SQL_APPEND = 1;
        public static final int FREEMARKER_PARAMS = 2;
    }

    // 字段可操作类型代码
    public static interface FieldsOperTypeCode {
        public static final int NO_NOTSHOW = 0;
        public static final int NO_SHOW = 1;
        public static final int YES_SHOW = 2;
        public static final int YES_NOTSHOW = 3;
        public static final int YES_SHOW_DISABLED = 4;
        public static final int NO_INCREMENT = 5;

        public static final Set<Integer> OPERABLE = Util.set(new Integer[]{Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4)});
        public static final Set<Integer> NOTOPERABLE = Util.set(new Integer[]{Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5)});
    }

    public static interface SqlIdTypeCode {
        public static final int GUID = 1;
        public static final int IDENTITY = 2;
        public static final int TIMEGEN = 3;
    }

    // 方法参数类型
    public static interface MethodParamsType {
        public static final String NORMOL = "1";


        public static final String AUTO = "2";


        public static final String SYSTEM_DATA = "3";


        public static final String PARAM_QUERY = "1";


        public static final String PARAM_UPDATE = "2";
    }


    // 定制SQL展示 操作常量
    public static interface ViewExcuConstants {
        public static final String ADD = "1";


        public static final String UPDATA = "2";


        public static final String DEL = "3";


        public static final String BUTTON_METHOD = "4";


        public static final String EXPORT = "5";


        public static final String METHOD = "6";


        public static final String SEARCH = "7";


        public static final String SORT = "8";


        public static final String IMPORT = "9";
    }

    // 展示脱敏常量
    public static interface ViewTuoMingConstants {

        // 脱敏 手机
        public static final int TUOMING_PHONE = 1;

        // 脱敏 电话
        public static final int TUOMING_TEL_PHONE = 2;

        // 脱敏 身份证
        public static final int TUOMING_IDCARD = 3;

        // 脱敏 姓名
        public static final int TUOMING_NAME = 4;

        // 脱敏 银行卡
        public static final int TUOMING_BANKCARD = 5;

        // 脱敏 地址
        public static final int TUOMING_ADDRESS = 6;

        // 脱敏 QQ号码
        public static final int TUOMING_QQ = 7;

        // 脱敏 微信
        public static final int TUOMING_WEIXIN = 8;
    }

    // 字典数据展示类型
    public static interface ViewSetDataConstants {
        // 前端
        public static final String FRONT = "1";

        // 后台
        public static final String BACKGROUND = "2";
    }

    // 方法类型
    public static interface ViewMethodTypeConstants {
        public static final String METHOD_ADD = "1";


        public static final String METHOD_DEL = "2";


        public static final String METHOD_UPDATE = "3";


        public static final String METHOD_SEARCH = "4";

        // 返回JSON
        public static final String RETURN_TYPE_JSON = "1";

        // 返回数组
        public static final String RETURN_TYPE_ARRAY = "2";
    }


    public static interface ViewDataTypeConstants {
        public static final String BIND_FIELD = "0";


        public static final String DATA_NOMAL = "1";


        public static final String DATA_CUR_DATE = "2";


        public static final String DATA_CUR_USER_ID = "3";


        public static final String DATA_CUR_USER_NAME = "4";


        public static final String DATA_SYS_LSH = "5";


        public static final String DATA_RANDOM_NUM = "6";


        public static final String DATA_CUR_USER_DEPT_ID = "7";


        public static final String DATA_CUR_USER_DEPT_NAME = "8";


        public static final String DATA_CUR_USER_POS_ID = "9";


        public static final String DATA_CUR_USER_POS_NAME = "10";


        public static final String DATA_CUR_USER_CREATERID = "11";


        public static final String DATA_CUR_MAIN_TABLE_ID = "12";


        public static final String GROOVY_SCRIPT = "13";


        public static final String ENV = "15";
    }


    public static interface FieldTypeConstants {
        public static final String FIELD_TYPE_COMMON = "1";


        public static final String FIELD_TYPE_EXPAND = "2";


        public static final String FIELD_TYPE_VIR = "3";
    }

    // 按钮类型
    public static interface ViewButtonTypeConstants {
        // 行内
        public static final String INLINE = "1";
        // 全局
        public static final String GLOBLE = "2";

        // 链接
        public static final String HREF = "3";

        // 调用方法
        public static final String METHOD = "4";


        public static final String DATA_TYPE_NOMAL = "1";

        public static final String DATA_TYPE_AUTO = "2";
    }


    public static interface SqlTypeConstants {
        public static final String TYPE_SQL = "1";


        public static final String TYPE_TABLE = "2";


        public static final String TYPE__MUTI_TABLE = "3";


        public static final String TYPE_SQL_TABLE = "4";
    }


    public static interface SqlTableTypeConstants {

        // 主表
        public static final String TABLE_MAIN = "1";

        // 从表
        public static final String TABLE_SUB = "2";

        // 是否从表-是
        public static final boolean IS_SUB_TRUE = true;

        // 是否从表-否
        public static final boolean IS_SUB_FALSE = false;
    }


    public static interface ConditionShowType {

        // 显示
        public static final Integer SHOW = Integer.valueOf(1);
        // 隐藏
        public static final Integer HIDE = Integer.valueOf(2);
        // 不启用
        public static final Integer DISABLED = Integer.valueOf(3);
        // 删除
        public static final Integer REMOVE = Integer.valueOf(4);
    }

    public static interface GroupByType {
        public static final int NORMAL = 1;
        public static final int TIME = 2;
        public static final int CUSTOMER = 3;
    }

    // 数据来源类型
    public static interface DataFromType {
        // 数据来源-接口
        public static final int DATAFROM_INTERFACE = 1;
        // 数据来源-备份
        public static final int DATAFROM_BACKUP = 2;
    }

    // 常用环境变量
    public static interface ParamNameConstants {
        public static final String CUR_USERID = "\\$\\{currentUserId\\}";
        public static final String CUR_CREATERID = "\\$\\{curCreaterId\\}";
        public static final String CUR_USERNAME = "\\$\\{currentUserName\\}";
        public static final String CUR_ORG_ID = "\\$\\{currentOrgId\\}";
        public static final String CUR_ORG_NAME = "\\$\\{currentOrgName\\}";
        public static final String CUR_POST_ID = "\\$\\{curPosId\\}";
        public static final String CUR_POST_NAME = "\\$\\{curPostName\\}";
        public static final String CUR_DATE = "\\$\\{curDate\\}";
        public static final String CUR_TIME = "\\$\\{curTime\\}";
        public static final String CUR_DATE_TIME = "\\$\\{curDateTime\\}";
        public static final String MAIN_TABLE_ID = "\\$\\{mainTableId\\}";
        public static final String ENV = "\\$\\{env\\}";
        public static final String MAIN_TABLE_ID_NOMARL = "${mainTableId}";
    }

    // 按钮点击类型
    public static interface BtnClickTypeConstants {
        // 直接请求
        public static final int BTNCLICKTYPE_DIRECT = 0;
        // 事件按钮
        public static final int BTNCLICKTYPE_EVENT = 1;
        // 标签页/tab页
        public static final int BTNCLICKTYPE_TAB = 2;
        // 普通对话框
        public static final int BTNCLICKTYPE_DIALOG = 3;
        // TOP对话框
        public static final int BTNCLICKTYPE_DIALOG_TOP = 4;
        // 新页面
        public static final int BTNCLICKTYPE_NEW_PAGE = 5;
        // 文件下载
        public static final int BTNCLICKTYPE_FILE_DOWNLOAD = 6;
        // 列表导出
    }
}
